#ifndef __USB_DEVICE_H__
#define __USB_DEVICE_H__

#include "intf_usb.h"




#define IOCTL_CMD_RW 0x39654127
#define LIBUSB_BULK_TRANSFER_TIMEOUT 5000

#define BulkIoPhase_In          0x80
#define BulkIoPhase_Out         0x00
#define BulkIoPhase_Idle        0xff
#define BulkIoSignature         0x43425355
#define BULK_IO_ACK             0x53425355

#define BULK_IO_ACK_1 1
#define BULK_IO_ACK_0 1

#define DEV_PORT_PATH_LEN 200

typedef struct _USB_DEV_STRUCT_
{
    INTF_USB_HANDLE_STRUCT usb_handle;
    INTF_USB_ID_STRUCT usb_id;
    char dev_port_path[DEV_PORT_PATH_LEN];

    uint8 bulk_io_ack_state;

    uint8 mcu_type; //mcu类型
    uint8 autosuspend_flag;//0: 不自动挂起，1: 自动挂起
}USB_DEV_STRUCT;


extern int32 usb_dev_module_init(USB_DEV_STRUCT *this);
extern int32 usb_dev_open(USB_DEV_STRUCT *this, INTF_USB_ID_STRUCT *id_table);
extern int32 usb_dev_close(USB_DEV_STRUCT *this);
extern int32 usb_send_data(USB_DEV_STRUCT *this, uint8 *buf, int32 len, int32 *write_len);
extern int32 usb_read_data(USB_DEV_STRUCT *this, uint8 *buf, int32 len, int32 *read_len);
extern int32 *usb_get_dev_handle(USB_DEV_STRUCT *this);
extern int32 usb_dev_set_mcu_type(USB_DEV_STRUCT *this, uint8 type);
extern uint8 usb_dev_get_mcu_type(USB_DEV_STRUCT *this);
extern int usb_dev_enable_autosuspend(USB_DEV_STRUCT *this);
extern int32 usb_set_autosuspend_flag(USB_DEV_STRUCT *this, uint8 flag);

#endif

